home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15602 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  49 lines

  1. Path: ix.netcom.com!news
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: extern func() declaration?
  5. Date: Fri, 19 Apr 1996 19:39:40 GMT
  6. Organization: Netcom
  7. Message-ID: <3177ea73.162423432@nntp.ix.netcom.com>
  8. References: <316436C5.413E@micromedia.on.ca> <4l67qu$drk@sun001.spd.dsccc.com> <4l7dod$a0k@nntp.Stanford.EDU>
  9. NNTP-Posting-Host: ix-dc19-07.ix.netcom.com
  10. X-NETCOM-Date: Fri Apr 19  2:38:11 PM CDT 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. karish@pangea.Stanford.EDU (Chuck Karish) wrote:
  14.  
  15. > In article <4l67qu$drk@sun001.spd.dsccc.com>,
  16. > Mike McCarty <jmccarty@sun1307.spd.dsccc.com> wrote:
  17. > >In article <316436C5.413E@micromedia.on.ca>,
  18. > >Richard Steadman  <rsteadma@micromedia.on.ca> wrote:
  19. > >
  20. > >)What's the difference between
  21. > >)
  22. > >)    extern int func(void);
  23. > >)
  24. > >)and
  25. > >)
  26. > >)    int func(void);
  27. > >)
  28. > >)when declaring functions located in another source file?
  29. > >
  30. > >Pedantic differences aside, they mean -exactly- the same thing.
  31. > One not-so-pedantic difference is that the declaration with
  32. > "extern" also works when the function is actually defined in
  33. > the same source module, while the one without is liable to cause
  34. > "multiply defined" error messages from the compiler.
  35.  
  36. It's only likely to do that if it is not a C compiler.  In C
  37.  
  38.     extern int func(void);
  39.  
  40. and
  41.  
  42.     int func(void);
  43.  
  44. are equivalent as Mike McCarthy wrote.
  45.  
  46.  
  47. Michael M Rubenstein
  48.